package com.heatingcharge.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.common.collect.Lists;
import com.heatingcharge.entity.sys.SysDept;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;

@Data
public class DeptLevelDTO extends SysDept  {
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<DeptLevelDTO> children = Lists.newArrayList();

    public static DeptLevelDTO adapt(SysDept sysDept){
        DeptLevelDTO dto=new DeptLevelDTO();
        BeanUtils.copyProperties(sysDept,dto);
        return dto;
    }

}
